<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<title>${name_china}管理列表</title>
<%@include file="/common/head.jsp" %>

<!-- 时间日期插件 -->
<link href="<%=request.getContextPath()%>/static/plugin/My97DatePicker/skin/default/datepicker.css" rel="stylesheet" >
<script src="<%=request.getContextPath()%>/static/plugin/My97DatePicker/WdatePicker.js"></script>
<style>
.ordercount{
	width:100%;
    display: inline-flex;
}
.samestatic{
	width:309px;
	height:150px;
	margin-top:10px;
	margin-left:77px;
}
.samestatic:nth-child(1){
	margin-left:0px;
}
.ordersty{
	background:#1f95ef;
}
.balance{
	background:#45b854;
}
.customer{
	background:#f86b67;
}
.sametitle{
	color: #fff;
    font-size: 16px;
    margin-left: 20px;
    margin-top: 10px;
}
.sameorderinfo{
	color: #fff;
    margin-left: 35px;
    line-height:20px;
}
.summer-datagrid-cell{
	text-align:center;
}
/*******批量备注*******/
.remarkcon{
    height: 77px;
    background: #fff;
    border: solid 1px #e1e6eb;
    border-bottom: 0;
}
.remarkbut{
	width:114px;
	height:34px;
	border:solid 1px #f86b67;
	line-height:34px;
	text-align:center;
	color:#f86b67;
	margin:20px;
	cursor:pointer;
}
.smallremark{
	color: #1f95ef;
    font-size: 10px;
    margin-left: 7px;
}
.copybut{
	color:#0474c8;
	margin-left: 5px;
	cursor:pointer;
    margin-right: 8px;
}
/***按钮选中态****/
.pitchbut{
	background:#f86b67;
	color:#fff;
}
/*******表格样式*********/
.proleft{
  float:left;
  margin-top: 2px;
  width: 33%;
}
.proleft>img{
  width:84px;
  height:84px;
}
.proright{
  float:left;
  margin-left:2px;
  margin-top: 2px;
  text-align: left;
      width: 66%;
  
}
.sametr{
	height: 110px;
    border-bottom: solid 1px #999;
}
.summer-top{
	padding:0px !important;
}
</style>
</head>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>${name_china}管理</span>
        </div>
        <div id="toolbar" style="float: right"></div>
    </div>
    <div class="page-title-border"></div>
</div>
<!-- -订单详细信息- -->
<div class="ordercount">
	<div class="samestatic ordersty">
		<h1 class="sametitle">订单</h1>
		<p class="sameorderinfo">待发货订单：${sendingNo}</p>
	    <p class="sameorderinfo">待确认收货：${receivingNo}</p>
		<p class="sameorderinfo">异常订单：${exceptNo}</p>
		<p class="sameorderinfo">锁定待退货订单：${lockedNo}</p>
	</div>
	
	<div class="samestatic customer">
		<h1 class="sametitle">售后</h1>
		<p class="sameorderinfo">待审核：${loadingNo}</p>
		<p class="sameorderinfo">已审核：${checkedNo}</p>
		<p class="sameorderinfo">已完成：${finishedNo}</p>		
	</div>
</div>
<div class="search-field">
	        <input type="hidden" class="summer-input" id="id" name="id"/>
	        <!-- <input type="hidden" class="summer-input" id="note" name="note"/>
	        <input type="hidden" class="summer-input" id="noteLevel" name="noteLevel"/> -->
	<span class="field-cont">
        <span class="field-cont-title">商品名称</span>
        <input type="text" class="summer-input" id="goodsName"/>
    </span>
    <span class="field-cont">
        <span class="field-cont-title">商品编号</span>
        <input type="text" class="summer-input" id="spuId"/>
    </span>
     <span class="field-cont">
        <span class="field-cont-title">SKU 编码</span>
        <input type="text" class="summer-input" id="skuId"/>
    </span><br/>

     <span class="field-cont">
        <span class="field-cont-title">下单时间</span>
	    <input type="text" id="createTime" name="createTime" class="summer-input summer-validatebox"  onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" data-validatebox="validType:['maxLength[50]']"/> 
    </span>
    
     <span class="field-cont">
        <span class="field-cont-title">至</span>
	    <input type="text" id="updateTime" name="updateTime" class="summer-input summer-validatebox"  onFocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" data-validatebox="validType:['maxLength[50]']"/> 
    </span>
   
     <span class="field-cont">
        <span class="field-cont-title">卖家昵称 /ID</span>
        <input type="text" class="summer-input" id="userId"/>
    </span><br/>
     <span class="field-cont">
        <span class="field-cont-title">　　电话</span>
        <input type="text" class="summer-input" id="userPhone"/>
    </span>
     <span class="field-cont">
        <span class="field-cont-title">支付方式</span>
        <input type="text" class="summer-input" id="payType"/>
    </span>
    <span class="field-cont">
        <span class="field-cont-title">物流单号</span>
        <input type="text" class="summer-input" id="expressNo"/>
    </span>
    <span class="field-cont">
        <!-- <span class="field-cont-title">订单状态</span> -->
        <input type="hidden" class="summer-input" id="state" value="6"/>
    </span>
     <span class="field-cont">
        <span class="field-cont-title">订单来源</span>
        <input type="text" class="summer-input" id="source"/>
    </span>
      <span class="field-cont">
        <span class="field-cont-title">订单号码</span>
        <input type="text" class="summer-input" id="orderNo"/>
    </span>
    <br/>

    <span class="field-btn-wrapper">
        <a id="search" class="btn btn-primary btn-icon wave distance-right"><i class="icon icon-search"></i></a>
        <a id="reset" class="btn btn-icon wave wave-dark"><i class="icon icon-refresh"></i></a>
    </span>
</div>
<div id="t-wrap">
	<table class="summer-datagrid" >
		<colgroup>
			<col width="10%">
		    <col width="10%">
		    <col width="10%">
		    <col width="10%">
		    <col width="10%">
		    <col width="10%">
		    <col width="10%"> 
		    <col width="10%">
		    <col width="10%">
		    <col width="10%">
	    </colgroup>
	    <thead class="orderhead">
	    	<tr>
	    		<th><div class="summer-datagrid-cell"><a id="init" href="javascript:;">全部订单</a></div></th>
	    		<th><div class="summer-datagrid-cell"><a id="paying" href="javascript:;">待付款</a></div></th>
	    		<th><div class="summer-datagrid-cell"><a id="sending" href="javascript:;">待发货</a></div></th>
	    		<th><div class="summer-datagrid-cell"><a id="receiving" href="javascript:;">待收货</a></div></th>
	    		<th><div class="summer-datagrid-cell"><a id="finished" href="javascript:;">已完成</a></div></th>
	    		<th><div class="summer-datagrid-cell  pitchbut">换货订单</div></th>
	    		<th><div class="summer-datagrid-cell"><a id="back" href="javascript:;">退货订单</a></div></th>
	    		<th><div class="summer-datagrid-cell"><a id="offed" href="javascript:;">交易关闭</a></div></th>
	    		<th><div class="summer-datagrid-cell"><a id="locked" href="javascript:;">锁定订单</a></div></th>
	    		<th><div class="summer-datagrid-cell"><a id="except" href="javascript:;">异常订单</a></div></th>
	    	</tr>
	    </thead>
		
	</table>
	
	<div class="remarkcon">
		<div class="remarkbut" id="batchNote"><a>批量备注</a></div>
	</div>
	
	<div id="t-wrap">
    <table class="summer-datagrid" id="dataList">
	    <col width="10%">
	    <col width="20%">
	    <col width="20%">
	    <col width="70%">
	    <col width="30%">
	    <col width="30%">
	    <col width="20%">
	    <col width="20%">
	    <col width="20%">
	    <col width="20%">
	    <col width="28%">	    
	    <thead>
		     <tr>
		    <th><div class="summer-datagrid-cell"><input type="checkbox" id="addBatchAll"></div></th>
		    <th><div class="summer-datagrid-cell">订单编号</div></th>
		    <th><div class="summer-datagrid-cell">下单时间</div></th>
		    <th><div class="summer-datagrid-cell">商品信息</div></th>
		    <th><div class="summer-datagrid-cell">优惠</div></th>
		    <th><div class="summer-datagrid-cell">金额</div></th>
		    <th><div class="summer-datagrid-cell">当前状态</div></th>
		    <th><div class="summer-datagrid-cell">物流</div></th>
		    <th><div class="summer-datagrid-cell">昵称/ID</div></th>
		    <th><div class="summer-datagrid-cell">买家备注</div></th>
		    <th><div class="summer-datagrid-cell">操作<a class="summer-datagrid-cell">备注筛选</a></div></th>
			 </tr>
	    </thead>
    </table>
</div>
</div>

<script>
	//请求url
	var CONST_URL = {
		LIST: basePath + '${common_url}list',
	   	INIT_ADD: basePath + "${common_url}initAdd",
	   	INIT_EDIT: basePath + "${common_url}initEdit",
	   	INIT_VIEW: basePath + "${common_url}initView",
	   	DEL: basePath + "${common_url}del",
	   	INIT_SEND: basePath + "${common_url}initSend",
	   	INIT_PAY: basePath + "${common_url}initPay",
	   	INIT_RECEIVE: basePath + "${common_url}initReceive",
	   	INIT_FINISH: basePath + "${common_url}initFinish",
	   	INIT_CHANGE: basePath + "${common_url}initChange",
	   	INIT_BACK: basePath + "${common_url}initBack",
	   	INIT_OFF: basePath + "${common_url}initOff",
	   	INIT_LOCK:basePath + "${common_url}initLock",
	   	INIT_EXCEPT: basePath + "${common_url}initExcept",
	   	INIT_MAIN: basePath + "${common_url}init",
	   	SEND: basePath + "${common_url}send",
	   	INIT_RECEIVE_MSG: basePath + "${common_url}editReceiveMsg",
	   	INIT_DELAYSEND_MSG: basePath + "${common_url}delaySendMsg",
	   	INIT_CLOSE: basePath + "${common_url}initClose",
	   	INIT_SEND_REMIND: basePath + "${common_url}sendRemind",
	   	ADD_NOTE: basePath + "${common_url}addnote",
	   	GET_COUNT: basePath + "${common_url}getCount"
	};
	
    var  skuId ,
    goodsName ,
    userPhone,
    spuId,
    sendingNo,
    receivingNo,
    exceptNo,
    lockedNo,
    loadingNo,
    checkedNo,
    finishedNo,
    
    permission = CommonUtil.getPermission('${name_english}');
    
    $(function () {
    	
    	/******头部点击事件*******/
    	/*
    	$(".orderhead .summer-datagrid-cell").on('click',function(){
    		$(".orderhead .summer-datagrid-cell").removeClass('pitchbut');
    		$(this).addClass('pitchbut');
    		
    	});
    	*/
    	 $('#payType').combobox({
             valueField : 'code',
             textField : 'name',
             url : COMMON_URL.getCode + '?type=T_DM_T_ORDERS_DETAIL_PAY_TYPE'
         });
    	 $('#source').combobox({
   		 	valueField : 'code',
            textField : 'name',
            url : COMMON_URL.getCode + '?type=T_ORDERS_DETAIL_SOURCE'
   	 	});
    	
    	/************/
        // 查询按钮
        $('#batchNote').on('click',addbatchNote);
        $('#search').on('click', reloadTable);
    	$('#init').on('click',toMain);
        $('#sending').on('click',toSending);
       // $('#paying').on('click',toPaying);
        $('#receiving').on('click',toReceiving);
        $('#finished').on('click',toFinished);
        $('#change').on('click',toChange);
        $('#back').on('click',toBack);
        $('#offed').on('click',toOff);
        $('#locked').on('click',toLock);
        $('#except').on('click',toExcept);
        
      //重置按钮
        
	$('#reset').on('click', function() {
			//重置文本框的值

			$('#orderNo').val('');
			$('#createTime').val('');
			$('#updateTime').val('');
			$('#userId').val('');
			$('#userPhone').val('');//
			$('#payType').combobox('clear');
			$('#source').combobox('clear');
			$('#expressNo').val('');
			$('#spuId').val('');//
			$('#goodsName').val('');
			$('#userPhone').val('');
			$('#spuId').val('');
			$('#goodsName').val('');
			$('#skuId').val('');
			reloadTable();
		});
      //选中顶部勾选框
      $('#addBatchAll').on('click',checkAll);
	//新建
		$('#toolbar').on('click', 'a[data-permit="${name_english}:initAdd"]',
				function() {
					window.location.href = CONST_URL.INIT_ADD;
				});

		createTable();
		getCount();
		//查看
		$('#t-wrap').on(
				'click',
				'a[data-permit="${name_english}:initView"]',
				function() {
					var $this = $(this), id = $this.closest('tr').find('td[data-field="id"]').attr('data-value');
					orderNo = $this.closest('tr').find('td[data-field="orderNo"]').attr('data-value');
					window.location.href = CONST_URL.INIT_VIEW + "?orderNo=" + orderNo;
				});

		//查看
		$('#t-wrap').on('click','a[data-permit="${name_english}:initSend"]',
				function() {
					var $this = $(this), 
					id = $this.closest('tr').find('td[data-field="id"]').attr('data-value');
					window.location.href = CONST_URL.INIT_SEND + "?id=" + id;
				});

		//查看
		$('#t-wrap').on('click','a[data-permit="${name_english}:send"]',
				function() {
					var $this = $(this), 
					orderNo = $this.closest('tr').find('td[data-field="orderNo"]').attr('data-value');
					window.location.href = CONST_URL.SEND + "?orderNo="+ orderNo;
				});

		//编辑
		$('#t-wrap').on('click','a[data-permit="${name_english}:initEdit"]',
				function() {
					var $this = $(this), id = $this.closest('tr').find('td[data-field="id"]').attr('data-value');
					window.location.href = CONST_URL.INIT_EDIT + '?id=' + id;
				});

		//发货
		$('#t-wrap').on('click','a[data-permit="${name_english}:initSending"]',
				function() {
					var $this = $(this), id = $this.closest('tr').find('td[data-field="id"]').attr('data-value');
					window.location.href = CONST_URL.INIT_SENDING+ '?id=' + id;
						});
		var iWidth;                         //弹出窗口的宽度;
        var iHeight;                        //弹出窗口的高度;
        var iTop = (window.screen.height-60-iHeight)/2;       //获得窗口的垂直位置;
        var iLeft = (window.screen.width-20-iWidth)/2;        //获得窗口的水平位置;
		//修改收货信息
		$('#t-wrap').on('click','a[data-permit="${name_english}:editReceiveMsg"]',function() {
			var $this = $(this), 
		        orderNo = $this.closest('tr').find('td[data-field="orderNo"]').attr('data-value');
				userId = $this.closest('tr').find('td[data-field="userId"]').attr('data-value');				
				window.open(CONST_URL.INIT_RECEIVE_MSG+'?orderNo=' + orderNo+"&userId="+userId,'newwindow','height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no') ;
			   });
		//关闭订单initClose
		$('#t-wrap').on('click','a[data-permit="${name_english}:initClose"]',function() {
			var $this = $(this), 
				id = $this.closest('tr').find('td[data-field="id"]').attr('data-value');
		        orderNo = $this.closest('tr').find('td[data-field="orderNo"]').attr('data-value');
				userId = $this.closest('tr').find('td[data-field="userId"]').attr('data-value');				
				window.open(CONST_URL.INIT_CLOSE+'?orderNo=' + orderNo+"&userId="+userId+'&id='+id,'newwindow','height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no') ;
			   });
		
		//addnote
		$('#t-wrap').on('click','a[data-permit="${name_english}:addnote"]',function() {
			var $this = $(this), 
				id = $this.closest('tr').find('td[data-field="id"]').attr('data-value');
		        orderNo = $this.closest('tr').find('td[data-field="orderNo"]').attr('data-value');
		        note = $this.closest('tr').find('td[data-field="note"]').attr('data-value');
		        noteLevel = $this.closest('tr').find('td[data-field="noteLevel"]').attr('data-value');
				window.open(CONST_URL.ADD_NOTE+'?orderNo='+orderNo+'&id='+id+'&note='+note+'&level='+noteLevel,'newwindow','height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no') ;
			   });
		//延迟发货提醒
		$('#t-wrap').on(
				'click',
				'a[data-permit="${name_english}:delaySendMsg"]',
				function() {
					var $this = $(this), id = $this.closest('tr').find(
							'td[data-field="id"]').attr('data-value');
					window.location.href = CONST_URL.INIT_DELAYSEND_MSG
							+ '?id=' + id;
				});
		//关闭订单
		$('#t-wrap').on(
				'click',
				'a[data-permit="${name_english}:close"]',
				function() {
					var $this = $(this), id = $this.closest('tr').find(
							'td[data-field="id"]').attr('data-value');
					window.location.href = CONST_URL.INIT_CLOSE + '?id=' + id;
				});
		//提示发货消息
		$('#t-wrap').on(
				'click',
				'a[data-permit="${name_english}:sendRemind"]',
				function() {
					var $this = $(this), id = $this.closest('tr').find(
							'td[data-field="id"]').attr('data-value');
					window.location.href = CONST_URL.INIT_SEND_REMIND + '?id='
							+ id;
				});

		//删除
		$('#t-wrap').on(
				'click',
				'a[data-permit="${name_english}:delete"]',
				function() {
					var $this = $(this), id = $this.closest('tr').find(
							'td[data-field="id"]').attr('data-value');
					$.sdialog({
						type : 'confirm',
						msg : '您确定要删除选中的记录吗?',
						onConfirm : function(result) {
							if (result) {
								$.sajax({
									url : CONST_URL.DEL + "?ids=" + id,
									onLoadSuccess : function() {
										$.stip({
											type : 'ok',//显示类型 有info、 ok、 danger
											text : '删除成功！'
										});
										reloadTable();
									}
								});

							}
						}
					});
				});

	});
	// 重新加载表格
	function reloadTable() {
		skuId = trimSpace($('#skuId').val());
		goodsName = trimSpace($('#goodsName').val());
		userPhone = trimSpace($('#userPhone').val());
		spuId = trimSpace($('#spuId').val());
		createTable(skuId, goodsName, userPhone, spuId);
		$('#dataList').datagrid('reload', {
			ajax : {
				param : {
					"orderNo" : trimSpace($('#orderNo').val()),
					"createTime" : trimSpace($('#createTime').val()),
					"updateTime" : trimSpace($('#updateTime').val()),
					"userId" : trimSpace($('#userId').val()),
					"userPhone" : trimSpace($('#userPhone').val()),//
					"payType": $('#payType').combobox('getValue'),
					"source": $('#source').combobox('getValue'),
					"expressNo" : trimSpace($('#expressNo').val()),
					"state" : trimSpace($('#state').val()),
					"spuId" : trimSpace($('#spuId').val())//
				//"startTime": trimSpace($('#startTime').val()),
				//"stopTime": trimSpace($('#stopTime').val())
				}
			}
		});
	}
	
	//关闭子页面
	function closeWindow(object, isReload) 
    {
        object.close();
        isReload===true  && window.location.reload();
    }
	//获取表头统计信息
	function getCount(){
		 $.ajax({
		        url : CONST_URL.GET_COUNT,
		        type : "get",
		        async : false,
		        data : {},
		        dataType : "json",
		        success : function(data) {
		            pageTotal = data.pageTotal;
		        }
		    });
	}
	 
	//创建表格
	function createTable(skuId, goodsName, userPhone, spuId) {
		$('#dataList')
				.datagrid(
						{
							ajax : {
								url : CONST_URL.LIST + "?" + skuId + userPhone
										+ goodsName + spuId,
								param : {
									"orderNo" : trimSpace($('#orderNo').val()),
									"skuId" : trimSpace($('#skuId').val()),
									"createTime" : trimSpace($('#createTime').val()),
									"updateTime" : trimSpace($('#updateTime').val()),
									"userId" : trimSpace($('#userId').val()),
									"userPhone" : trimSpace($('#userPhone').val()),//
									"payType": $('#payType').combobox('getValue'),
									"source": $('#source').combobox('getValue'),
									"expressNo" : trimSpace($('#expressNo').val()),
									"state" : trimSpace($('#state').val()),
									"spuId" : trimSpace($('#spuId').val()),//
									"goodsName" : trimSpace($('#goodsName').val())
								},
								success : function(data) { //成功 
									alert("Data Saved: " + msg);
								}
							},
							columns : [
									{
										field : 'id',
										hidden : true
									},
									{
										field : 'userId',
										hidden : true
									},
									{
										field : 'note',
										hidden : true
									},
									{
										field : 'noteLevel',
										hidden : true
									},
									{
										render : function(rowData){
											return '<input type="checkbox" class="selcheckbox" id="id" name="id" value="'+rowData.id+'">';
										}
									},
									{
										field : 'orderNo'
									},
									{
										field : 'createTime'
									},
									{
										render : function(rowData) {
											var goodsHtml = null;
											for (var i = 0; i < rowData.list.length; i++) {
												if(goodsHtml != null){
													goodsHtml = goodsHtml + 
													'<div class="sametr">'
													+'<div class="proleft">'
													+ '<img src = "'+rowData.list[i].goodsImg+'">'
													+ '</div>'
													+ '<div class="proright">'
													+ '<p>'
													+ rowData.list[i].goodsName
													+ '</p>'
													+ '<p>商品数量：'
													+ rowData.list[i].count
													+ '</p>'
													+ '<p>货号：'
													+ rowData.list[i].skuId
													+ '</p>'
													+ '</div>'
													+'</div>';
												}else{
													goodsHtml ='<div class="sametr">'
														+'<div class="proleft">'
														+ '<img src = "'+rowData.list[i].goodsImg+'">'
														+ '</div>'
														+ '<div class="proright">'
														+ '<p>'
														+ rowData.list[i].goodsName
														+ '</p>'
														+ '<p>商品数量：'
														+ rowData.list[i].count
														+ '</p>'
														+ '<p>货号：'
														+ rowData.list[i].skuId
														+ '</p>'
														+ '</div>'
														+'</div>';
												}
											}
											return goodsHtml;
										}
									},
									{
										render : function(rowData) {
											var yjhtml = null;
											for (var i = 0; i < rowData.list.length; i++) {
												if(yjhtml != null){
													yjhtml = yjhtml 
													+'<div class="sametr">'
													+ '<div>'
													+ '<p>优惠券：'
													+ rowData.list[i].yjAmount
													+ '</p>'
													+ '<p>佣金比例：'
													+ rowData.list[i].yjpercent
													+ '</p>' + '</div>'
													+'</div>';
												}else{
													yjhtml = '<div class="sametr">'
														+ '<div>'
														+ '<p>优惠券：'
														+ rowData.list[i].yjAmount
														+ '</p>'
														+ '<p>佣金比例：'
														+ rowData.list[i].yjpercent
														+ '</p>' + '</div>'
														+'</div>';
												}
											}
											return yjhtml;
										}
									},
									{
										render : function(rowData) {
											var payhtml = null;
											for (var i = 0; i < rowData.list.length; i++) {
												if(payhtml!= null){
													payhtml = payhtml 
													+'<div class="sametr">'
													+'<div>'
													+'<p>成交价：'
													+ rowData.list[i].price
													+'</p>'
													+ '<p>原价：'
													+ rowData.list[i].originPrice
													+ '</p>'
													+ '</div>'
													+ '</div>';
												}else{
													payhtml = '<div class="sametr">'
													+'<div>'
													+'<p>成交价：'
													+ rowData.list[i].price
													+'</p>'
													+ '<p>原价：'
													+ rowData.list[i].originPrice
													+ '</p>'
													+ '</div>'
													+ '</div>';
												}
											}
											return payhtml;
										}
									},
									{
					    		    	 render: function (rowData) {
					    		    		 var statehtml= null;
					                         for(var i=0;i<rowData.list.length;i++){
					                        	 if(statehtml!= null){
						                        	 statehtml = statehtml + 
						                        	 '<div class="sametr">'+'<p>'+rowData.list[i].state+'</p>'+'</div>';
					                        	 }else{
						                        	 statehtml = '<div class="sametr">'+'<p>'+rowData.list[i].state+'</p>'+'</div>';
					                        	 }
					                           }  
					                         return statehtml;
					                       }
					    		     },
					    		     {    //物流
					    		    	 render: function (rowData) {
					    		    		 var expresshtml= null;
					                         for(var i=0;i<rowData.orderExpressList.length;i++){
					                        	 if(expresshtml!= null){
					                        		 expresshtml = expresshtml + 
						                        	 '<div class="sametr">'+'<p>'+rowData.orderExpressList[i].expressName+':'+rowData.orderExpressList[i].expressNo+'</p>'+'</div>';
					                        	 }else{
					                        		 expresshtml = '<div class="sametr">'+'<p>'+rowData.orderExpressList[i].expressName+':'+rowData.orderExpressList[i].expressNo+'</p>'+'</div>';
					                        	 }
					                           }  
					                         if(expresshtml != null){
					                        	 
					                         }
					                         return expresshtml;
					                       }
					    		     },
									{
										field : 'userNickName'
									},
									{
										field : 'customNote'
									},
									{
										render : function(rowData) {
											sendingNo = rowData.sendingNo;
											receivingNo = rowData.receivingNo;
										    exceptNo = rowData.exceptNo;
										    lockedNo = rowData.lockedNo;
										    loadingNo = rowData.loadingNo;
										    checkedNo = rowData.checkedNo;
										    finishedNo = rowData.finishedNo;
										    
											return $.funcbar({
														data : permission, //请求的数据
														type : 'text', //类型
														display : 7, //显示数量
														permit : [
																'${name_english}:initView',
																'${name_english}:addnote'
																 ]
													//需要的权限按钮
													});
										}
									}

							]
						});
	}
	
	function checkAll(){
		 $("[name='id']").attr("checked",'true');//全选 
	}
	//批量添加备注
	function addbatchNote(){
		
		var id = $("input[name='id']:checked").serialize();
		var iWidth;                         //弹出窗口的宽度;
        var iHeight;                        //弹出窗口的高度;
        var iTop = (window.screen.height-60-iHeight)/2;       //获得窗口的垂直位置;
        var iLeft = (window.screen.width-20-iWidth)/2;        //获得窗口的水平位置;
		window.open(CONST_URL.ADD_NOTE+'?id='+id,'newwindow','height='+iHeight+',innerHeight='+iHeight+',width='+iWidth+',innerWidth='+iWidth+',top='+iTop+',left='+iLeft+',toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no') ;
	}
	//跳转代发货页面
	function toMain() {
		window.location.href = CONST_URL.INIT_MAIN;
	}
	function toSending() {
		window.location.href = CONST_URL.INIT_SEND;
	}
	
	function toPaying() {
		window.location.href = CONST_URL.INIT_PAY;
	}
	function toReceiving() {
		window.location.href = CONST_URL.INIT_RECEIVE;
	}
	function toFinished() {
		window.location.href = CONST_URL.INIT_FINISH;
	}
	function toChange() {
		window.location.href = CONST_URL.INIT_CHANGE;
	}
	function toBack(){
		window.location.href = CONST_URL.INIT_BACK;
	}
	function toOff() {
		window.location.href = CONST_URL.INIT_OFF;
	}
	function toLock() {
		window.location.href = CONST_URL.INIT_LOCK;
	}
	function toExcept() {
		window.location.href = CONST_URL.INIT_EXCEPT;
	}
</script>
</body>
</html>